package com.yc.spring;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class) 
@ContextConfiguration(value= {"/applicationContext.xml","/rabbitmq-context.xml"})
public class TestRMq {
	
	@Autowired
	private RabbitTemplate template;

	@Test
	public void send() {
		//RabbitMQ模板
        //发送消息
        template.convertAndSend("Hello, 鸟鹏!");
        try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}// 休眠1秒
	}
}
